﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Active.Core;

public partial class System_SystemSettings : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            txtSystemName.Text = CompanySettings.Instance.SystemName;
            txtBalanceBillRows.Text = CompanySettings.Instance.BalanceBillMainRows.ToString();
            txtMediaBillRows.Text = CompanySettings.Instance.MediaBillMainRows.ToString();
            txtTVMediaDescription.Text = CompanySettings.Instance.TVMediaDescription;
            txtPublicationMediaDescription.Text = CompanySettings.Instance.PublicationMediaDescription;
        }
        this.btnSaveSetting.Visible = CompanySettings.Instance.CanEdit();
    }
    protected void btnSaveSetting_Click(object sender, EventArgs e)
    {
        CompanySettings.Instance.SystemName = txtSystemName.Text;
        CompanySettings.Instance.MediaBillMainRows = int.Parse(txtMediaBillRows.Text);
        CompanySettings.Instance.BalanceBillMainRows = int.Parse(txtBalanceBillRows.Text);
        CompanySettings.Instance.TVMediaDescription = txtTVMediaDescription.Text;
        CompanySettings.Instance.PublicationMediaDescription = txtPublicationMediaDescription.Text;

        CompanySettings.Instance.Save();
    }
}
